package com.sandbox.ws;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.JAXBElement;

import org.springframework.batch.item.ItemWriter;

import com.edb.finance.collateral.wsdomain.collateralitem.v1.Collateralitem;
import com.sandbox.ws.client.CheckInClientImlp;
import com.sandbox.ws.client.CheckInClient;

@SuppressWarnings("rawtypes")
public class CollateralItemWriter implements ItemWriter<Collateralitem>{

	public void write(List<? extends Collateralitem> items) throws Exception {
		List<Collateralitem> collateralitems = new ArrayList<Collateralitem>();
//		for (JAXBElement jaxbElement : jaxbElements) {
//			Collateralitem collateralitem = (Collateralitem)(jaxbElement).getValue();
//			collateralitems.add(collateralitem);
//		}
		collateralitems.addAll(items);
		CheckInClient collateralItemWebServiceClient = new CheckInClientImlp();
		collateralItemWebServiceClient.insertCollateralItems(collateralitems);
	}
}



